var stompClient=null;
function connect() {
    var socket=new SockJS('/chat');
    stompClient=Stomp.over(socket);
    stompClient.connect({},function (frame) {
        stompClient.subscribe('/user/queue/messge',function (chat) {
            showGreeting(JSON.parse(chat.body));
        });
    });
}
function sendMsg() {
    stompClient.send("/app/getxx",{},JSON.stringify({'content':$("#content").val(),'to':$("#to").val()}));
}
function showGreeting(message) {
    $("#chatsContent").append("<div>"+message.from+":"+message.content+"</div>")
}
$(function () {
    connect();
    $("#send").click(function () {
        sendMsg();
    })
})